<?php
/**
 * Created by PhpStorm.
 * User: mayn
 * Date: 2020/9/2
 * Time: 9:14
 */

require_once '../class/RedLock.php';
$servers = [
    ['127.0.0.1', 6379, 0.01],
    ['127.0.0.1', 6380, 0.01],
    ['127.0.0.1', 6381, 0.01],
];
$redLock = new RedLock($servers);
while (true) {
    $lock = $redLock->lock('test', 10000);
    if ($lock) {
        print_r($lock) ."<br/>";
    } else {
        echo "Lock not acquired" . "<br/>";
    }
}

/*$lock = $redLock->lock('test', 100000);
if($lock){
    print_r($lock);
}else{
    echo '锁获取失败';
}*/
